package com.huadao.cart_ccs.common.deviceController;

public abstract class BasePumpController extends BaseController {
    protected int speed;
    protected byte direction;
    protected byte alarm;

    protected int settingSpeed;//设置的速度
    protected byte settingDirection;//设置的方向

    public void set(int speed,byte direction){
        this.speed=speed;
        this.direction=direction;
    }

    public void set(int speed,byte direction,byte alarm){
        this.speed=speed;
        this.direction=direction;
        this.alarm=alarm;
    }

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public byte getDirection() {
        return direction;
    }

    public void setDirection(byte direction) {
        this.direction = direction;
    }

    public byte getAlarm() {
        return alarm;
    }

    public void setAlarm(byte alarm) {
        this.alarm = alarm;
    }

    //判断转向是否改变,当运行蠕动泵时设置的方向和蠕动泵当前的方向不同时，需要先停止蠕动泵，再启动。如果当前蠕动泵未运行，则直接启动
    public boolean isDirectionChange(byte newDirection){
        if(speed!=0&&newDirection!=this.direction){
            return true;
        }else {
            return false;
        }
    }

    public int getSettingSpeed() {
        return settingSpeed;
    }

    public void setSettingSpeed(int settingSpeed) {
        this.settingSpeed = settingSpeed;
    }

    public byte getSettingDirection() {
        return settingDirection;
    }

    public void setSettingDirection(byte settingDirection) {
        this.settingDirection = settingDirection;
    }
}
